home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / Pascal / Snippets / PNL Libraries / Libraries / SpriteWorld / SpriteWorld files / Interfaces / SpriteFrame.p < prev    next >
Text File  |  1996-11-24  |  4KB  |  105 lines

  1. {/--------------------------------------------------------------------------------------}
  2. {    SpriteFrame.h}
  3. {}
  4. {    Portions are copyright: © 1991-94 Tony Myles, All rights reserved worldwide.}
  5. {/--------------------------------------------------------------------------------------}
  6.  
  7. unit SpriteFrame;
  8.  
  9. interface
  10.  
  11.     uses
  12. {$IFC undefined THINK_Pascal}
  13.         Types, Quickdraw, 
  14. {$ENDC}
  15.         QDOffscreen, SWCommonHeaders;
  16.  
  17. {$PUSH}
  18. {$ALIGN MAC68K}
  19.  
  20. {/--------------------------------------------------------------------------------------}
  21. {    frame type definitions}
  22. {/--------------------------------------------------------------------------------------}
  23.  
  24.     type
  25.         UInt32Array = array[0..0] of UInt32;
  26.         UInt32ArrayPtr = ^UInt32Array;
  27.         FrameRec = record
  28.                 framePort: GWorldPtr;        { GWorld for the frame image}
  29.                 framePixHndl: PixMapHandle;    { handle to pix map (saved for unlocking/locking)}
  30.                 framePix: PixMapPtr;        { pointer color pix map (valid only while locked)}
  31.  
  32.                 frameBaseAddr: Ptr;        { base address of pixel data (valid only while locked)}
  33.                 frameRowBytes: LongInt;    { number of bytes in a row of the frame}
  34.                 leftAlignFactor: Integer;    { used to align the rect.left to the nearest long word }
  35.                 rightAlignFactor: Integer;    { used to align the rect.right to the nearest long word}
  36.                 isFrameLocked: Boolean;        { has the frame been locked?}
  37.  
  38.                 frameRect: Rect;            { source image rectangle}
  39.                 offsetPoint: Point;        { image offset factor relative to destination rectangle}
  40.                 maskRgn: RgnHandle;            { image masking region}
  41.                 tileMaskIsSolid: Boolean;     { used by SWDrawTilesAboveSprite}
  42.  
  43.                 maskPort: GWorldPtr;        { GWorld for the mask image}
  44.                 maskPixHndl: PixMapHandle;    { handle to pix map (saved for unlocking/locking)}
  45.                 maskPix: PixMapPtr;        { pointer to color pix map (valid only while locked)}
  46.  
  47.                 maskBaseAddr: Ptr;    { base address of mask pixel data (valid only while locked)}
  48.  
  49.                 sharesGWorld: Boolean;    { shares GWorld with other frames}
  50.  
  51.                 useCount: Integer;        { number of sprites using this frame}
  52.  
  53.                 numScanLines: Integer;
  54.                 worldRectOffset: Integer;  { non-whole-byte offset for 1-bit blitter}
  55.                 scanLinePtrArray: UInt32ArrayPtr; { array of pointers to each scanline}
  56.  
  57.                 pixCodeH: PixelCodeHdl;        { handle to compiled sprite data}
  58.                 frameBlitterP: BlitFuncPtr;    { procPtr to compiled sprite data}
  59.             end;
  60.         FramePtr = ^FrameRec;
  61.         FrameHdl = ^FramePtr;
  62.         FrameArray = array[0..0] of FramePtr;
  63.         FrameArrayPtr = ^FrameArray;
  64.  
  65. {/--------------------------------------------------------------------------------------}
  66. {    frame flags constants}
  67. {/--------------------------------------------------------------------------------------}
  68.  
  69.     type
  70.         MaskType = SignedByte;
  71.     const
  72.         kNoMask = 0;
  73.         kPixelMask = 1;
  74.         kRegionMask = 2;
  75.         kFatMask = (kPixelMask + kRegionMask);
  76.         kSolidMask = 4;
  77.  
  78.  
  79.     function SWCreateWindowFrame (var newFrameP: FramePtr; var frameRect: Rect): OSErr;
  80.     function SWCreateFrameFromCicnResource (destSpriteWorld: SpriteWorldPtr; var newFrameP: FramePtr; iconResID: Integer; maskKind: MaskType): OSErr;
  81.     function SWCreateFrameFromPictResource (destSpriteWorld: SpriteWorldPtr; var newFrameP: FramePtr; pictResID: Integer; maskResID: Integer; maskKind: MaskType): OSErr;
  82.     function SWCreateFrameFromGWorldAndRect (var newFrameP: FramePtr; pictGWorld: GWorldPtr; maskGWorld: GWorldPtr; var frameRect: Rect; maskKind: MaskType): OSErr;
  83.     
  84.     function SWCreateFrameFromGWorldAndRectStart (var tempMaskGWorld: GWorldPtr; maxWidth, maxHeight: integer ): OSErr;
  85.     procedure SWCreateFrameFromGWorldAndRectFinish ( tempMaskGWorld: GWorldPtr );
  86.     function SWCreateFrameFromGWorldAndRectPartial (var newFrameP: FramePtr; pictGWorld,  maskGWorld, tempMaskGWorld: GWorldPtr; var frameRect: Rect; maskKind: MaskType): OSErr;
  87.  
  88.     function SWCreateFrame (theGDH: GDHandle; var newFrameP: FramePtr; var frameRect: Rect): OSErr;
  89.     function SWCreateFrameFromDepth( var newFrameP: FramePtr; depth: integer; var frameRect: Rect): OSErr;
  90.     function SWCloneFrame (cloneFrameP: FramePtr; var newFrameP: FramePtr): OSErr;
  91.  
  92.     procedure SWInitializeFrame (tempFrameP: FramePtr; depth: Integer);
  93.     function SWDisposeFrame (oldFrameP: FramePtr): Boolean;
  94.     procedure SWSetFrameMaskRgn (srcFrameP: FramePtr; maskRgn: RgnHandle);
  95.     procedure SWLockFrame (srcFrameP: FramePtr);
  96.     procedure SWUnlockFrame (srcFrameP: FramePtr);
  97.  
  98. {$ALIGN RESET}
  99. {$POP}
  100.  
  101. {$IFC not undefined THINK_Pascal}
  102. implementation
  103. {$ENDC}
  104. end.
  105.